<?php 
class Admin_Form_Category extends Zend_Form{
    
   public function init(){
        $this->setMethod("post");
		$this->setName("CategoryForm");
        $this->setAttrib('autocomplete', 'off');	        	

        $this->setElementDecorators(array(
            array('ViewHelper'),
            array('Errors'),
            array('Description'),
            array('Label', array('separator'=>' ')),
            array('HtmlTag', array('tag' => 'li', 'class'=>'element-group')),
        ));

        
        
        $name = new Zend_Form_Element_Text('name');
        $name->setLabel('Tên danh mục')
             ->setRequired(true)
             ->addValidator('NotEmpty',true,array('messages' => 'Không được chống!'));
             
        $name->setAttrib('size', '60');
        
        $name_en = new Zend_Form_Element_Text('name_en');
        $name_en->setLabel('Tên danh mục Engish');     
        $name_en->setAttrib('size', '70');
        
        $name_chi = new Zend_Form_Element_Text('name_china');
        $name_chi->setLabel('Tên danh mục China');     
        $name_chi->setAttrib('size', '70');
		
        $category   = new Vina_Model_DeveloperMapper();
        $data       = $category->TreeMenu(0);
        
        foreach($data as $valueCat):
        $idCat = $valueCat['id'];
        $optionCat[$idCat] = $valueCat['name'];
        endforeach;
		
		$optionCat['0'] = "Chọn Danh mục!";
                 
        $category = new Zend_Form_Element_Select('category_id');
        $category->setLabel('Danh mục')
              ->setMultiOptions($optionCat);
        $category->setValue(0);
		
		$order = new Zend_Form_Element_Text('order');
        $order->setLabel('Thứ tự');
        $order->setAttrib('size', '10');
        
        
        
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Save');
        $submit->class = "bt-save";
        
        $this->addElements(array($name, $category, $order,
        $submit));                                           
    }  
}
